﻿using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace test
{
    internal class Program
    {
        static void Main(string[] args)
        {
            try
            {
                string s = @"{""incident_id"":""669c6c0d-e4a7-4a93-bf05-5964e3b14a16"",""apply_no"":""0399069250003XG"",""applicant"":""顾明辉"",""appdate"":""2025-01-09 09:01:35"",""cert_type"":""111"",""cert_number"":""220523197907210052"",""contact_num"":""18101714885"",""email"":null,""req_type"":""02"",""company"":""PDXQZLS"",""card_id"":""10000014792"",""settle_method"":""01"",""ywyhdz"":""上海市浦东新区川沙镇桃园新村19号201室"",""address"":""桃园19号201室"",""address_check"":""02"",""oper_type"":""01"",""CertList"":[{""cert_source"":""02"",""cert_type"":""113"",""cert_number"":""220523197907210052"",""file_uuid"":""bcea5d771aa5443e94744d1badeb28ba"",""filename"":""aec548fe-a37f-422d-ae8d-0945c891b173.jpg"",""web_uri"":""aec548fe-a37f-422d-ae8d-0945c891b173.jpg"",""app_type"":""01"",""name"":""顾明辉"",""bus_type"":""01"",""cert_effect_date"":"""",""cert_expire_date"":"""",""cert_address"":"""",""address_check"":""02""},{""cert_source"":""02"",""cert_type"":""111"",""cert_number"":""220523197907210052"",""file_uuid"":""cf78162abd014f848497b02b332398de"",""filename"":""5a736d94-4248-4df0-967d-2f60279a909d.jpg"",""web_uri"":""5a736d94-4248-4df0-967d-2f60279a909d.jpg"",""app_type"":""01"",""name"":""顾明辉"",""bus_type"":""01"",""cert_effect_date"":"""",""cert_expire_date"":"""",""cert_address"":"""",""address_check"":""02""},{""cert_source"":""02"",""cert_type"":""113"",""cert_number"":""321084198207205222"",""file_uuid"":""11c0046d-b7f5-4ca9-a897-680c329712c4"",""filename"":""d53b5ba3-51b8-47e4-87c0-b68fb1e189b8.jpg"",""web_uri"":""d53b5ba3-51b8-47e4-87c0-b68fb1e189b8.jpg"",""app_type"":""02"",""name"":""张志娟"",""bus_type"":""01"",""cert_effect_date"":null,""cert_expire_date"":null,""cert_address"":""上海市浦东新区川沙镇桃园新村19号201室"",""address_check"":""01""},{""cert_source"":""02"",""cert_type"":""113"",""cert_number"":""321084198207205222"",""file_uuid"":""9a803476c1fc4290a7c19174f23db34b"",""filename"":""ad63c0d0-bc48-4288-b478-a1b6b5205867.jpg"",""web_uri"":""ad63c0d0-bc48-4288-b478-a1b6b5205867.jpg"",""app_type"":""02"",""name"":""张志娟"",""bus_type"":""02"",""cert_effect_date"":null,""cert_expire_date"":null,""cert_address"":""上海市浦东新区川沙镇桃园新村19号201室"",""address_check"":""01""},{""cert_source"":""02"",""cert_type"":""111"",""cert_number"":""321001200802210615"",""file_uuid"":""11c0046d-b7f5-4ca9-a897-680c329712c4"",""filename"":""54ab38e2-28a9-4d33-927a-18c4b573d336.jpg"",""web_uri"":""54ab38e2-28a9-4d33-927a-18c4b573d336.jpg"",""app_type"":""02"",""name"":""顾炎希"",""bus_type"":""01"",""cert_effect_date"":null,""cert_expire_date"":null,""cert_address"":""上海市浦东新区川沙镇桃园新村19号201室"",""address_check"":""01""},{""cert_source"":""02"",""cert_type"":""113"",""cert_number"":""321001200802210615"",""file_uuid"":""1b8117e0965f4b48a37df6f5f852cd48"",""filename"":""3353e433-5ee1-42ce-8bf8-de7ebae962d5.jpg"",""web_uri"":""3353e433-5ee1-42ce-8bf8-de7ebae962d5.jpg"",""app_type"":""02"",""name"":""顾炎希"",""bus_type"":""02"",""cert_effect_date"":null,""cert_expire_date"":null,""cert_address"":""上海市浦东新区川沙镇桃园新村19号201室"",""address_check"":""01""},{""cert_source"":""02"",""cert_type"":""111"",""cert_number"":""620103194911291522"",""file_uuid"":""11c0046d-b7f5-4ca9-a897-680c329712c4"",""filename"":""9d9d92c0-bd37-47db-856d-0d2917c3d2ab.jpg"",""web_uri"":""9d9d92c0-bd37-47db-856d-0d2917c3d2ab.jpg"",""app_type"":""02"",""name"":""顾国芳"",""bus_type"":""01"",""cert_effect_date"":null,""cert_expire_date"":null,""cert_address"":""上海市浦东新区川沙镇桃园新村19号201室"",""address_check"":""01""},{""cert_source"":""02"",""cert_type"":""802"",""cert_number"":""620103194911291522"",""file_uuid"":""f2d1635ffa3442b5ac5bd08b5382b21c"",""filename"":""d7ed8bc6-ee2b-4a38-b32f-32edac1aae1b.jpg"",""web_uri"":""d7ed8bc6-ee2b-4a38-b32f-32edac1aae1b.jpg"",""app_type"":""02"",""name"":""顾国芳"",""bus_type"":""02"",""cert_effect_date"":null,""cert_expire_date"":null,""cert_address"":""上海市浦东新区川沙镇桃园新村19号201室"",""address_check"":""01""},{""cert_source"":""02"",""cert_type"":""802"",""cert_number"":""620103194911291522"",""file_uuid"":""2e41fec77f2e4d2fb739d27a4e80b3b4"",""filename"":""05275bf3-bda7-4cb8-a825-4a9410e9e236.jpg"",""web_uri"":""05275bf3-bda7-4cb8-a825-4a9410e9e236.jpg"",""app_type"":""02"",""name"":""顾国芳"",""bus_type"":""02"",""cert_effect_date"":null,""cert_expire_date"":null,""cert_address"":""上海市浦东新区川沙镇桃园新村19号201室"",""address_check"":""01""},{""cert_source"":""02"",""cert_type"":""111"",""cert_number"":""41272419860607093X"",""file_uuid"":""11c0046d-b7f5-4ca9-a897-680c329712c4"",""filename"":""2455ec59-87a6-441f-8c63-0e41b07785f6.jpg"",""web_uri"":""2455ec59-87a6-441f-8c63-0e41b07785f6.jpg"",""app_type"":""02"",""name"":""王振辉"",""bus_type"":""01"",""cert_effect_date"":null,""cert_expire_date"":null,""cert_address"":""上海市浦东新区川沙镇桃园新村19号201室"",""address_check"":""01""},{""cert_source"":""02"",""cert_type"":""802"",""cert_number"":""41272419860607093X"",""file_uuid"":""4e865e3acb304739b61486fe5e128387"",""filename"":""411c39fa-a3d4-49e9-b48f-32492971d9f2.jpg"",""web_uri"":""411c39fa-a3d4-49e9-b48f-32492971d9f2.jpg"",""app_type"":""02"",""name"":""王振辉"",""bus_type"":""02"",""cert_effect_date"":null,""cert_expire_date"":null,""cert_address"":""上海市浦东新区川沙镇桃园新村19号201室"",""address_check"":""01""},{""cert_source"":""02"",""cert_type"":""802"",""cert_number"":""41272419860607093X"",""file_uuid"":""e00a1ba022244aae9f268b28a5981fbd"",""filename"":""5d0b1984-503f-42bc-9983-dcdab615639a.jpg"",""web_uri"":""5d0b1984-503f-42bc-9983-dcdab615639a.jpg"",""app_type"":""02"",""name"":""王振辉"",""bus_type"":""02"",""cert_effect_date"":null,""cert_expire_date"":null,""cert_address"":""上海市浦东新区川沙镇桃园新村19号201室"",""address_check"":""01""},{""cert_source"":""02"",""cert_type"":""111"",""cert_number"":""341621199804204127"",""file_uuid"":""tbfp-2b367a4275b24d44aa75815ff78ffc5f"",""filename"":""aa57023d-3200-4433-9f3d-38ce871d388c.jpg"",""web_uri"":""aa57023d-3200-4433-9f3d-38ce871d388c.jpg"",""app_type"":""02"",""name"":""朱京京"",""bus_type"":""01"",""cert_effect_date"":null,""cert_expire_date"":null,""cert_address"":""上海市浦东新区川沙镇桃园新村19号201室"",""address_check"":""01""},{""cert_source"":""02"",""cert_type"":""111"",""cert_number"":""341621199804204127"",""file_uuid"":""tbfp-81a346461124417b87e87086485a546c"",""filename"":""41d81ceb-7af2-4e40-b5ea-5f8bdb277e3b.jpg"",""web_uri"":""41d81ceb-7af2-4e40-b5ea-5f8bdb277e3b.jpg"",""app_type"":""02"",""name"":""朱京京"",""bus_type"":""01"",""cert_effect_date"":null,""cert_expire_date"":null,""cert_address"":""上海市浦东新区川沙镇桃园新村19号201室"",""address_check"":""01""},{""cert_source"":""02"",""cert_type"":""802"",""cert_number"":""341621199804204127"",""file_uuid"":""tbfp-c2877b8fa08a4ae894fde90503f6a171"",""filename"":""24e42b8f-e361-42bc-8633-d7425d00e5cf.jpg"",""web_uri"":""24e42b8f-e361-42bc-8633-d7425d00e5cf.jpg"",""app_type"":""02"",""name"":""朱京京"",""bus_type"":""02"",""cert_effect_date"":null,""cert_expire_date"":null,""cert_address"":""上海市浦东新区川沙镇桃园新村19号201室"",""address_check"":""01""},{""cert_source"":""02"",""cert_type"":""802"",""cert_number"":""341621199804204127"",""file_uuid"":""tbfp-c870af2c582c45c6b3163edf632809e5"",""filename"":""277869cd-2d3c-4de6-9012-1d780cc49ef9.jpg"",""web_uri"":""277869cd-2d3c-4de6-9012-1d780cc49ef9.jpg"",""app_type"":""02"",""name"":""朱京京"",""bus_type"":""02"",""cert_effect_date"":null,""cert_expire_date"":null,""cert_address"":""上海市浦东新区川沙镇桃园新村19号201室"",""address_check"":""01""}],""source"":""1""}";

                test.YWTBWebService.YWTB_WSSoapClient client = new YWTBWebService.YWTB_WSSoapClient();

                test.YWTBWebService.multiPopulationEntity entity = JsonConvert.DeserializeObject<test.YWTBWebService.multiPopulationEntity>(s);

                string sql = @"INSERT INTO VEOLIAUSER.WTB_WENJIANXX (ID, S_ZHUBIAOBH, INCIDENT_ID, CERT_SOURCE, CERT_TYPE, CERT_NUMBER, FILE_UUID, FILENAME, WEB_URI, 
    I_BEIYONG1, I_BEIYONG2, I_BEIYONG3, S_BEIYONG1, S_BEIYONG2, S_BEIYONG3, D_BEIYONG1, D_BEIYONG2, D_BEIYONG3
)VALUES(WTB_WENJIANXX_SEQUENCES.nextval, '251734358867', '{0}'
, '{1}', '{2}', '{3}', '{4}'
, '{5}', '{6}'
, NULL, NULL, 343674, '{7}|{8}', '{9}', '{10}|{11}', NULL, NULL, NULL); ";
                StringBuilder execsql = new StringBuilder();
                foreach (var item in entity.CertList)
                {
                    execsql.AppendLine(string.Format(sql, entity.incident_id, item.cert_source, item.cert_type, item.cert_number
                        , item.file_uuid, item.filename, item.web_uri, item.app_type, item.bus_type, item.name, item.cert_address, item.address_check));
                }

                string ssss = execsql.ToString();

                var res = client.multiPopulation(entity);
                Console.ReadLine();
            }
            catch (Exception ex)
            { 
                Console.WriteLine(ex.Message);
            }

            Console.ReadLine();
        }
    }
}
